package com.zqq.glide;

import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;

import com.bumptech.glide.Glide;
import com.bumptech.glide.load.resource.bitmap.RoundedCorners;
import com.bumptech.glide.request.RequestOptions;
import com.zqq.glide.myview.HeightBottomViewActivity;

/**
 * @author Ybgame
 */
public class MainActivity extends AppCompatActivity {

    ImageView imageView;
    ImageView imageView2;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        String url = "https://manhua.qpic.cn/vertical/0/07_22_36_afe651da2ab940d0e257a1ec894bd992_1504795010150.jpg/420";

        imageView = findViewById(R.id.iv);
        imageView2 = findViewById(R.id.iv2);

        Glide.with(this)
                .load(url)
                .apply(RequestOptions.bitmapTransform(new RoundedCorners(20)))
                .into(imageView);

        Glide.with(this)
                .load(url)
                .apply(RequestOptions.bitmapTransform(new RoundCorner(this, 50f, 0f, 20f, 0f)))
                .into(imageView2);

        imageView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                startActivity(new Intent(MainActivity.this, HeightBottomViewActivity.class));
            }
        });
    }

}
